Data

The contingency table:

knitr::kable(FrEnAuthors) %>% kable_styling("striped", full_width = F) %>% 
 scroll_box(width = "800px", height = "600px")
, . ? ! : ; ’ “«» -–
Hamilton, Francis 14829 7872 6 0 64 880 0 0 521
Chaucer, Geoffrey 215670 252362 2599 3610 6542 62830 40369 8462 30497
Bacon, Francis 25849 8790 147 13 1204 4704 638 632 919
Hobbes, Thomas 23666 6453 178 0 1302 5005 0 1458 757
Lovelace, Richard 6768 4771 204 387 438 905 2214 425 1768
Milton, John 40788 15336 1210 532 3079 5120 8589 1597 4119
Shakespeare, William 360569 421321 41442 21026 66454 44985 94898 4173 50614
Darwin, Erasmus 55208 45137 440 538 863 11743 2997 948 10434
Defoe, Daniel 251542 58788 3444 1187 6388 41434 20414 10447 15910
Johnson, Samuel 235691 84053 2987 1458 6765 32499 11164 7658 9975
Swift, Jonathan 133806 64109 2788 1482 9150 20732 11810 10730 13005
Tyson, Edward 3588 2321 17 2 420 389 345 232 276
Austen, Jane 65489 40571 2858 3764 1046 11478 1459 2580 4607
Babbage, Charles 12091 6986 105 5 460 1546 353 202 1296
Blake, William 1638 662 134 153 177 252 305 152 111
Brontë, Anne 21839 8309 1270 1226 1236 3468 0 0 1120
Brontë, Charlotte 57259 33734 4832 3097 4897 12116 4156 15139 16274
Brontë, Emily 9892 5142 779 1329 1173 1896 0 0 572
Carroll, Lewis 38940 29554 3310 7241 4107 4051 10872 20962 34327
Coleridge, Samuel Taylor 235188 149158 9194 24720 15408 24092 47845 16094 64949
Darwin, Charles 395756 294345 2904 1496 17512 56912 35116 25426 88464
Dickens, Charles 680618 334232 35756 45442 12391 66333 162004 75227 116988
Disraeli, Benjamin, Earl of Beaconsfield 144327 82700 8322 10218 4458 22106 34641 14951 12477
Eliot, George 156461 98647 7229 3919 6091 18817 20369 29340 39632
Engels, Friedrich 22865 11954 288 124 414 1552 955 2421 4004
Faraday, Michael 24341 16028 139 37 530 2510 247 146 8813
FitzGerald, Edward 18827 15598 591 643 3838 2900 5652 142 4913
Huxley, Thomas Henry 167348 83009 3054 816 4762 18665 12432 29748 35657
Keats, John 19396 11394 808 1168 1375 2491 4535 1549 11160
Lamb, Charles 20630 10828 824 809 559 2610 2694 2952 6542
Malthus, T. R. (Thomas Robert) 6851 2435 59 5 78 453 208 20 296
Marx, Karl 12629 7063 178 46 257 1048 165 291 1411
Moore, Thomas 132276 53367 2928 5917 4015 13176 24822 22491 46205
Roget, Peter Mark 55687 27905 52 659 124 32954 2369 1628 1946
Scott, Walter 843699 307616 25570 24394 8968 74870 113602 162457 185569
Scott, Walter Dill 3108 3685 44 0 75 316 820 0 882
Shelley, Mary Wollstonecraft 25738 12591 857 1076 785 5220 1382 2198 5605
Spencer, Herbert 42248 18851 927 107 1388 6784 1280 2961 9858
Stevenson, Robert Louis 396441 222781 17584 16692 10781 79020 46422 83869 71157
Wilde, Oscar 68412 57963 4250 4249 2376 4849 8622 1892 9226
Christie, Agatha 8723 11929 1806 1060 285 106 0 0 2172
Churchill, Winston 297911 245358 20343 10800 4986 15893 68836 137925 74980
Conrad, Joseph 132188 132350 9837 9546 3585 9902 24900 47824 41679
Doyle, Arthur Conan 260327 191878 17965 14250 1709 6736 40092 79196 44164
Fleming, J. A. (John Ambrose), Sir 3502 2269 0 0 54 208 153 142 520
Graves, Robert 4599 2703 226 253 265 446 552 434 1163
Hardy, Thomas 169233 117122 13061 14082 3939 17992 58653 11289 42599
Huxley, Aldous 9577 9694 783 434 281 989 2196 3785 2329
Joyce, James 24366 31406 3206 2330 3487 409 0 0 755
Kipling, Rudyard 192428 157438 16873 19546 4099 15147 117131 58843 95887
Kobbé, Gustav 34008 18897 341 791 779 1590 4242 9634 5538
Lawrence, D. H. (David Herbert) 118244 105982 10471 6722 3759 2729 26705 37777 28273
Maugham, W. Somerset (William Somerset) 82588 121671 10735 4017 1767 9005 41005 18526 12954
Potter, Beatrix 4557 5265 452 1100 96 1173 778 2646 3234
Russell, George William 14382 8692 610 401 780 1702 698 1785 3059
Saki 27119 17303 1125 372 486 3179 4335 7801 6443
Shaw, Bernard 78202 105320 12188 8285 8888 10922 18094 18544 16243
Wallace, Alfred Russel 65106 33915 265 171 916 5909 2268 3189 15843
Wallace, Edgar 65916 55897 6577 3668 751 2529 18194 58979 20852
Wodehouse, P. G. (Pelham Grenville) 150221 176614 20767 14274 1217 3885 70706 76091 38596
Woolf, Virginia 30455 21661 2234 1026 290 2985 1029 2348 3843
Yeats, W. B. (William Butler) 69240 42045 2977 1796 1608 6353 8879 3837 8579
Adams, Samuel 23053 14934 535 205 762 2217 1131 2259 4141
Franklin, Benjamin 113803 53353 1707 794 3160 12616 10341 7551 22454
Paine, Thomas 70776 31750 1268 366 1708 8293 1920 4131 5728
Cooper, Susan Fenimore 20133 10945 899 592 254 3941 2042 7903 4467
Hawthorne, Nathaniel 283940 112810 5729 10320 1067 28455 15439 37913 62878
Jerome, Jerome K. (Jerome Klapka) 84094 72931 6314 3005 2500 8239 19948 35220 22557
Melville, Herman 158576 62681 7069 9151 2788 29270 11388 20963 40730
Poe, Edgar Allan 95260 44433 2811 6162 1688 7247 1948 3264 16941
Thoreau, Henry David 85136 35961 1740 968 614 7908 2367 4691 13045
Webster, Noah 74895 121856 16134 167 1271 26512 1976 1466 2843
Austin, Mary Hunter 23209 17702 1193 762 196 1870 5152 8886 6068
Burgess, Thornton W. (Thornton Waldo) 47425 56145 3091 4321 646 701 20011 25274 6870
Burroughs, Edgar Rice 90502 79193 5278 3760 560 6379 11615 32111 24368
Burroughs, John 98763 52354 2168 2100 1450 10515 4321 10109 21534
Crane, Stephen 35832 36304 3395 3210 873 1253 11733 21577 11118
Eliot, T. S. (Thomas Stearns) 1869 1602 98 63 141 209 193 594 358
Fitzgerald, F. Scott (Francis Scott) 21640 23117 2214 1890 1400 1300 7294 13010 12358
Fitzgerald, Robert 3258 1979 224 426 22 245 1473 884 1257
Frost, Robert 1882 2085 307 156 149 182 1437 1180 1169
Ives, Charles 2247 1240 118 43 38 108 268 944 1554
James, William 70828 44584 2007 1471 1845 6026 12014 8134 17126
Johnston, Mary 122841 87276 7061 15430 799 6355 20954 52024 35107
London, Jack 209185 184271 10994 7880 2085 8903 43576 56267 50369
Lovecraft, H. P. (Howard Phillips) 8370 6893 80 145 295 873 2186 2935 1633
Muir, John 37633 16060 189 349 286 2203 1014 1446 7350
Reeve, Arthur B. (Arthur Benjamin) 72185 71763 6725 2050 494 647 13239 46940 18312
Tesla, Nikola 2667 1464 23 4 72 130 46 44 492
Train, Arthur Cheney 31177 31539 2899 4202 559 1612 9580 20791 11393
Twain, Mark 301782 214282 15091 17105 11896 45842 70254 27593 132977
Webster, Jean 30178 31735 3423 2671 561 3442 21779 14177 12467
James, Henry 325987 214862 25800 16171 7605 41188 80658 131176 115784
Montaigne, Michel de 59139 17130 1639 395 6590 6319 42399 3497 10466
Corneille, Pierre 81603 76179 5758 3803 9407 13414 74994 1658 17223
Descartes, René 8675 2675 216 28 569 1450 8953 0 1323
La Bruyère, Jean de 11914 3296 659 205 1376 2465 10869 0 1622
La Fayette, Madame de (Marie-Madeleine Pioche de La Vergne) 8454 4475 203 111 405 1653 9329 609 1849
La Fontaine, Jean de 928 508 73 38 171 163 905 0 191
Molière 33967 32228 3738 4712 1848 5018 24987 1148 18108
Racine, Jean 1437 803 243 150 64 126 1059 4 283
Sévigné, Madame de 19671 11838 731 817 3667 6615 18349 0 4013
Boileau Despréaux, Nicolas 1095 346 42 50 137 142 666 2 103
Diderot, Denis 44103 33153 4085 2849 3451 11748 41987 824 17307
Montesquieu, Charles de Secondat, baron de 18022 14469 557 286 2333 3396 15848 0 2430
Prévost, abbé 14424 9933 187 181 183 1370 14461 0 2347
Robespierre, Maximilien 20325 9450 1683 799 1327 4228 18472 426 3715
Voltaire 13091 7607 751 568 979 2330 10047 73 2264
Voltaire, Francois-Marie de 4625 2695 102 5 350 681 3676 58 1461
Balzac, Honoré de 107560 63066 6144 8468 4153 7165 67406 1695 47913
Barbey d’Aurevilly, J. (Jules) 24710 10961 815 2441 576 1008 17804 114 8760
Baudelaire, Charles 4222 1679 166 602 163 409 2619 37 1488
Brillat-Savarin 8961 4653 126 198 640 1893 7471 0 1653
Champollion, Jean-François 7551 3092 20 43 439 1222 5200 190 1505
Chateaubriand, René 13048 8243 408 407 2212 2057 10225 0 3753
Daudet, Alphonse 74593 61868 3101 6979 4478 4175 46940 7342 17543
Dumas, Alexandre 522106 271871 42670 49818 21523 58216 281228 11475 276532
Flaubert, Gustave 61192 34205 2597 8415 3656 8346 39629 4017 19977
Gautier, Théophile 58714 21310 1496 3316 2481 8761 35723 957 13727
Gounod, Charles 4265 1881 124 330 318 461 3650 0 946
Hugo, Victor 196544 120615 11050 20118 9532 21874 143906 1011 70776
Itard, Jean Marc Gaspard 1512 577 11 10 43 167 1343 0 226
Littré, Emile 1691 889 51 7 72 294 1479 2 366
Maupassant, Guy de 104591 61134 5000 5970 8033 8009 64082 7235 28390
Mérimée, Prosper 9560 7869 521 534 347 903 8313 4 3292
Michelet, Jules 315711 221203 7290 6042 17067 22295 181002 478 50705
Musset, Alfred de 32857 31251 5458 4873 1029 5977 26753 219 12377
Sand, George 413605 243856 25416 36394 14391 47229 358041 6909 138019
Stendhal 48796 31004 1833 2583 2639 6658 23672 1197 14557
Taine, Hippolyte 64602 33193 1605 1798 4103 9232 37267 258 19426
Talleyrand-Périgord, Charles Maurice de, prince de Bénévent 70092 43652 823 286 2499 6470 57717 774 15350
Tocqueville, Alexis de 21513 13081 296 42 1101 3961 23654 22 4976
Vallès, Jules 13891 13119 1224 4106 858 1468 13426 16 7100
Verlaine, Paul 4962 2231 237 796 165 153 3217 4 982
Verne, Jules 285418 177003 15625 31950 4473 10451 179124 6258 119209
Vigny, Alfred de 22390 11432 1242 2313 1471 3818 17656 670 9799
Zola, Émile 409494 204288 12229 28025 10125 19990 211618 459 87402
Adam, Paul 28966 31392 1263 3327 882 1422 18773 0 10520
Alain-Fournier 5814 4805 200 300 334 276 3876 246 2185
Allais, Alphonse 14480 11030 1296 2454 943 280 9979 10 8406
Claudel, Paul 4291 6434 1064 1033 68 51 4695 124 7081
Colette 12296 9867 1022 1190 746 219 7074 1377 4598
Fabre, Jean-Henri 15936 7663 494 224 560 1760 13282 0 1958
France, Anatole 111443 81740 3158 3448 8311 6074 81669 1419 30737
Gide, André 7289 6047 655 924 820 1658 6805 160 5116
Huysmans, J.-K. (Joris-Karl) 2009 696 42 108 56 268 1094 0 685
Le Bon, Gustave 10871 7827 189 50 572 578 10894 0 2884
Leblanc, Maurice 5052 4866 652 500 364 17 4133 2 3815
Loti, Pierre 99429 45989 1424 3795 3314 10353 51966 1154 21250
Maspero, G. (Gaston) 6908 4199 13 3 580 501 4730 8 1301
Massenet, Jules 7017 3697 155 684 309 247 4939 0 1280
Proust, Marcel 67836 26358 1456 1900 2429 2762 48827 4253 17833
Régnier, Henri de 1562 612 30 76 74 219 1297 0 105
Renard, Jules 10729 8610 855 1350 1083 270 7328 35 5180
Rostand, Edmond 2781 4301 646 2170 2621 110 2163 60 1186
Leroux, Gaston 24243 32336 2058 6618 1403 976 20197 2315 12984
Poe, Edgar Allan (in French) 28105 13886 861 1603 598 2684 21811 1129 13647

The pattern in heatmap

# Original data
heatmap(FrEnAuthors, Rowv = NA, Colv = NA)
# Row profiles
heatmap(makeRowProfiles(FrEnAuthors)$rowProfiles, Rowv = NA, Colv = NA)

# Deviation from independence
coul <- colorRampPalette(brewer.pal(8, "PiYG"))(25) # Pink (Neg) to Green (Pos)
heatmap(makeRowProfiles(FrEnAuthors)$deviations, Rowv = NA, Colv = NA, col = coul)

Run CA

ca.res <- epCA(FrEnAuthors, symmetric = TRUE, graphs = FALSE)

## get color
col.idx <- c(us = "maroon", fr = "royalblue3", uk = "darkorange1", ca = "red")
col.nationality <- recode(data.dx$Nationality, !!! col.idx)

col.idx2 <- c(`18th and before` = "#6A5ACD", `19th` = "#BA55D3", `20th on` = "#EE6AA7")
col.time <- recode(data.dx$Time.recod, !!! col.idx2)

col.type <- createColorVectorsByDesign(makeNominalData(as.matrix(data.dx$Type)))

Scree plot

PlotScree(ca.res$ExPosition.Data$eigs)

Factor scores

Components 1 & 2

Biplot

ca.plot.byNation <- createFactorMapIJ(ca.res$ExPosition.Data$fi, ca.res$ExPosition.Data$fj,axis1 = 1, axis2 = 2,
                                      text.cex.i = 3,
                                      col.points.i = col.nationality,
                                      col.labels.i = col.nationality,
                                      title = "Authors by nationality - Symmetric")

ca.plot.byTime <- createFactorMapIJ(ca.res$ExPosition.Data$fi, ca.res$ExPosition.Data$fj,axis1 = 1, axis2 = 2,
                                    text.cex.i = 3,
                                    col.points.i = col.time,
                                    col.labels.i = col.time,
                                    title = "Authors by Time - Symmetric")

ca.plot.byType <- createFactorMapIJ(ca.res$ExPosition.Data$fi, ca.res$ExPosition.Data$fj,axis1 = 1, axis2 = 2,
                                    text.cex.i = 3,
                                    col.points.i = col.type$oc,
                                    col.labels.i = col.type$oc,
                                    title = "Authors by Type - Symmetric")

ca.label <- createxyLabels.gen(1,2,
                               lambda = ca.res$ExPosition.Data$eigs,
                               tau = round(ca.res$ExPosition.Data$t),
                               axisName = "Component "
)

ca.plot.byNation$baseMap + ca.label + ca.plot.byNation$I_points + ca.plot.byNation$J_points + ca.plot.byNation$J_labels

ca.plot.byTime$baseMap + ca.label + ca.plot.byTime$I_points + ca.plot.byTime$J_points + ca.plot.byTime$J_labels

ca.plot.byType$baseMap + ca.label + ca.plot.byType$I_points + ca.plot.byType$J_points + ca.plot.byType$J_labels

Interactive

fi2plot <- ca.res$ExPosition.Data$fi[,1:2] %>% as.data.frame
fj2plot <- ca.res$ExPosition.Data$fj[,1:2] %>% as.data.frame
colnames(fj2plot) <- colnames(fi2plot) <- paste0("Component", c(1,2))

p2 <- ggplot() +
  geom_hline(yintercept = 0, size = 0.1) + geom_vline(xintercept = 0, size = 0.1) +
  geom_point(data = fi2plot, aes(x = Component1, y = Component2, text = rownames(ca.res$ExPosition.Data$fi)), color = col.nationality) +
  geom_point(data = fj2plot, aes(x = Component1, y = Component2), color = "darkolivegreen", pch = 18, size = 3) + 
  geom_text(data = fj2plot, aes(x = Component1, y = Component2, label = rownames(ca.res$ExPosition.Data$fj)), color = "darkolivegreen", size = 5, nudge_y = 0.08) + 
  theme_bw()
## Warning: Ignoring unknown aesthetics: text
ggplotly(p2, tooltip = c("text"))
Check interesting authors
checkPoe <- FrEnAuthors[c("Poe, Edgar Allan", "Poe, Edgar Allan (in French)", "Baudelaire, Charles"),]
checkPoe/rowSums(checkPoe)
##                                      ,         .          ?          !
## Poe, Edgar Allan             0.5299465 0.2471878 0.01563804 0.03428018
## Poe, Edgar Allan (in French) 0.3332978 0.1646744 0.01021062 0.01901001
## Baudelaire, Charles          0.3708388 0.1474747 0.01458059 0.05287659
##                                        :          ;          '        "«»
## Poe, Edgar Allan             0.009390612 0.04031621 0.01083703 0.01815815
## Poe, Edgar Allan (in French) 0.007091694 0.03182961 0.25865708 0.01338883
## Baudelaire, Charles          0.014317084 0.03592446 0.23003953 0.00324989
##                                      -–
## Poe, Edgar Allan             0.09424547
## Poe, Edgar Allan (in French) 0.16184005
## Baudelaire, Charles          0.13069829
## Select types
type2pick <- c("politician", "philosopher", "scientist", "naturalist")
experts <- cbind(FrEnAuthors[which(data.dx$Type %in% type2pick),], data.dx[which(data.dx$Type %in% type2pick),c("Nationality", "Type")])
experts.ord <- experts[order(experts$Type),c(1:9)]
showres <- cbind(experts.ord/rowSums(experts.ord), experts[order(experts$Type),c("Type", "Nationality")])
heatmap(as.matrix(experts.ord/rowSums(experts.ord)), Rowv = NA, Colv = NA, RowSideColors = createColorVectorsByDesign(makeNominalData(as.matrix(showres$Type)))$oc)

Row factor scores (Authors)

ca.plot.byNation <- createFactorMap(ca.res$ExPosition.Data$fi,axis1 = 1, axis2 = 2,
                                    text.cex = 3,
                                    col.points = col.nationality,
                                    col.labels = col.nationality,
                                    title = "Authors by nationality - Symmetric")#,

ca.plot.byNation$zeMap + ca.label
## Warning: ggrepel: 150 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps

ca.plot.byTime <- createFactorMap(ca.res$ExPosition.Data$fi,axis1 = 1, axis2 = 2,
                                  text.cex = 3,
                                  col.points = col.time,
                                  col.labels = col.time,
                                  title = "Authors by Time - Symmetric")#,

ca.plot.byTime$zeMap + ca.label
## Warning: ggrepel: 150 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps

Column factor scores (Punctuations)

ca.j.plot <- createFactorMap(ca.res$ExPosition.Data$fj,
                             axis1 = 1, axis2 = 2, 
                             text.cex = 5,
                             col.points = "darkolivegreen",
                             col.labels = "darkolivegreen",
                             pch = 18,
                             title = "Punctuations - Symmetric")#,

ca.j.plot$zeMap + ca.label

Components 2 & 3

Biplot

ca.plot.byNation23 <- createFactorMapIJ(ca.res$ExPosition.Data$fi, ca.res$ExPosition.Data$fj,
                                        axis1 = 2, axis2 = 3,
                                        text.cex.i = 3,
                                        col.points.i = col.nationality,
                                        col.labels.i = col.nationality,
                                        title = "Authors by nationality - Symmetric")

ca.plot.byTime23 <- createFactorMapIJ(ca.res$ExPosition.Data$fi, ca.res$ExPosition.Data$fj,
                                    axis1 = 2, axis2 = 3,
                                    text.cex.i = 3,
                                    col.points.i = col.time,
                                    col.labels.i = col.time,
                                    title = "Authors by Time - Symmetric")

ca.plot.byType23 <- createFactorMapIJ(ca.res$ExPosition.Data$fi, ca.res$ExPosition.Data$fj,
                                    axis1 = 2, axis2 = 3,
                                    text.cex.i = 3,
                                    col.points.i = col.type$oc,
                                    col.labels.i = col.type$oc,
                                    title = "Authors by Time - Symmetric")

ca.label23 <- createxyLabels.gen(2,3,
                               lambda = ca.res$ExPosition.Data$eigs,
                               tau = round(ca.res$ExPosition.Data$t),
                               axisName = "Component "
)

ca.plot.byNation23$baseMap + ca.label23 + ca.plot.byNation23$I_points + ca.plot.byNation23$J_points + ca.plot.byNation23$J_labels

ca.plot.byTime23$baseMap + ca.label23 + ca.plot.byTime23$I_points + ca.plot.byTime23$J_points + ca.plot.byTime23$J_labels

ca.plot.byType23$baseMap + ca.label23 + ca.plot.byType23$I_points + ca.plot.byType23$J_points + ca.plot.byType23$J_labels

Interactive

fi2plot23 <- ca.res$ExPosition.Data$fi[,2:3] %>% as.data.frame
fj2plot23 <- ca.res$ExPosition.Data$fj[,2:3] %>% as.data.frame
colnames(fj2plot23) <- colnames(fi2plot23) <- paste0("Component", c(2,3))

p2.23 <- ggplot() +
  geom_hline(yintercept = 0, size = 0.1) + geom_vline(xintercept = 0, size = 0.1) +
  geom_point(data = fi2plot23, aes(x = Component2, y = Component3, text = rownames(ca.res$ExPosition.Data$fi)), color = col.nationality) +
  geom_point(data = fj2plot23, aes(x = Component2, y = Component3), color = "darkolivegreen", pch = 18, size = 3) + 
  geom_text(data = fj2plot23, aes(x = Component2, y = Component3, label = rownames(ca.res$ExPosition.Data$fj)), color = "darkolivegreen", size = 5, nudge_y = 0.08) + 
  theme_bw()
## Warning: Ignoring unknown aesthetics: text
ggplotly(p2.23, tooltip = c("text"))

Row factor scores (Authors)

ca.plot.byNation23 <- createFactorMap(ca.res$ExPosition.Data$fi,axis1 = 2, axis2 = 3,
                                    text.cex = 3,
                                    col.points = col.nationality,
                                    col.labels = col.nationality,
                                    title = "Authors by nationality - Symmetric")#,

ca.plot.byNation23$zeMap + ca.label23
## Warning: ggrepel: 136 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps

ca.plot.byTime23 <- createFactorMap(ca.res$ExPosition.Data$fi,axis1 = 2, axis2 = 3,
                                  text.cex = 3,
                                  col.points = col.time,
                                  col.labels = col.time,
                                  title = "Authors by Time - Symmetric")#,

ca.plot.byTime23$zeMap + ca.label23
## Warning: ggrepel: 136 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps

Column factor scores (Punctuations)

ca.j.plot23 <- createFactorMap(ca.res$ExPosition.Data$fj,
                             axis1 = 2, axis2 = 3, 
                             text.cex = 5,
                             col.points = "darkolivegreen",
                             col.labels = "darkolivegreen",
                             pch = 18,
                             title = "Punctuations - Symmetric")#,

ca.j.plot23$zeMap + ca.label23